package cn.lixu.system.mapper;

import cn.lixu.basic.mapper.BaseMapper;
import cn.lixu.system.domain.Role;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 角色mapper层
 */
public interface RoleMapper extends BaseMapper<Role> {

    /**
     * 添加到中间表RolePermission
     *
     * @param id
     * @param permissions
     */
    void saveRolePermission(@Param("rid") Long id, @Param("permissions") List<Long> permissions);

    /**
     * 添加到中间表Rolemenu
     *
     * @param id
     * @param menus
     */
    void saveRolemenu(@Param("rid") Long id, @Param("menus") List<Long> menus);

    /**
     * 删除
     *
     * @param rid
     */
    //通过role的id删除EmployeeRole
    void removeEmployeeRole(Long rid);

    //通过role的id删除RoleMenu
    void removeRoleMenu(Long rid);

    //通过role的id删除RolePermission
    void removeRolePermission(Long rid);
}
